#coding=utf-8
import matplotlib.pyplot as plt 
import math
import numpy as np

x = np.arange(0,2*np.pi,0.01)

y = []
for i in x:
    t = 1.1*math.sin(i)
    if t > 1:
        t = 1
    elif t < -1:
        t = -1
    y.append(t)

z = []
for i in x:
    t = 1.1 * math.sin(i)
    if t > 1:
        t -= 1
    if t < -1:
        t += 1
    z.append(t)


fig = plt.figure(figsize=(8, 3))

plt.subplot(1, 2, 1)
plt.plot(x, z)
plt.yticks([-1, -0.5, 0, 0.5, 1])
plt.xticks([0, 0.5*math.pi, math.pi, 1.5*math.pi, 2*math.pi])
plt.xlabel('IGNORE')

plt.subplot(1, 2, 2)
plt.plot(x, y)
plt.yticks([-1, -0.5, 0, 0.5, 1])
plt.xticks([0, 0.5*math.pi, math.pi, 1.5*math.pi, 2*math.pi])
plt.xlabel('CLAMP')

plt.tight_layout()
plt.subplots_adjust(top=0.85)
plt.savefig('ignore_and_clamp.svg')
plt.show()
